import 'package:fate_blind_box/config/app_style.dart';
import 'package:fate_blind_box/widget/appbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import 'logic.dart';

class PaymentSetupPage extends GetView<PaymentSetupLogic> {
  const PaymentSetupPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const HzAppBar(
        text: '支付设置',
      ),
      backgroundColor: 'EDEDED'.stringToColor,
      body: Obx(() {
        return ListView.separated(
          padding: EdgeInsets.only(top: 12.w),
          itemBuilder: (context, index) {
            return InkWell(
              onTap: () => controller
                  .changePaymentMethod(controller.state.paymentMethod[index]),
              child: Container(
                padding: EdgeInsets.symmetric(horizontal: 16.w),
                alignment: Alignment.centerLeft,
                color: 'FFFFFF'.stringToColor,
                height: 56.w,
                child: Row(
                  children: [
                    Expanded(
                        child: Text(controller.state.paymentMethod[index])),
                    Icon(
                      Icons.chevron_right,
                      size: 32.w,
                      color: '#B5B5B5'.stringToColor,
                    )
                  ],
                ),
              ),
            );
          },
          itemCount: controller.state.paymentMethod.length,
          separatorBuilder: (BuildContext context, int index) {
            return Divider(
              height: 1,
              color: '#EDEDED'.stringToColor,
            );
          },
        );
      }),
    );
  }
}
